#include "../../../include/online/WebPageSearcher.hpp"

// Constructor
WebPageSearcher::WebPageSearcher(std::string keys, const TcpConnectionPtr& conn)
: _conn(conn)
{
    // 先处理回车
    if(!keys.empty() && (keys.back() == '\r' || keys.back() == '\n')){
        keys.erase(keys.size() - 1);
    }
    _sought = keys;
}

// 执行查询
void WebPageSearcher::doQuery()
{
    jsonResult = _query.doQuery(_sought);
}

#if 0
int main(){
    WebPageSearcher wps("清明", nullptr);
    wps.doQuery();
    return 0;
}
#endif
